<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Cron帮助</title>
    <meta name="description" content="生成器在线生成任务调度比如Quartz的Cron表达式,对Quartz Cron表达式的可视化双向解析和生成.">
    <meta name="author" content="zeyuphoenix">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <!-- #CSS Links -->
    <!-- Basic Styles -->
    <link rel="stylesheet" type="text/css" media="screen" href="/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" media="screen" href="/static/css/font-awesome.css">

    <!-- SmartAdmin Styles : Caution! DO NOT change the order -->
    <link rel="stylesheet" type="text/css" media="screen" href="/static/css/smartadmin-production-plugins.css">
    <link rel="stylesheet" type="text/css" media="screen" href="/static/css/smartadmin-production.css">
    <link rel="stylesheet" type="text/css" media="screen" href="/static/css/smartadmin-skins.css">

    <!-- #FAVICONS -->
    <link rel="shortcut icon" href="/static/img/favicon/favicon.ico" type="image/x-icon">
    <link rel="icon" href="/static/img/favicon/favicon.ico" type="image/x-icon">

    <!-- #GOOGLE FONT -->
    <link rel="stylesheet" href="/static/css/google-fonts.css?family=Open+Sans:300,400,600&subset=latin,latin-ext">

    <!-- #APP SCREEN / ICONS -->
    <!-- Specifying a Webpage Icon for Web Clip
         Ref: https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html -->
    <link rel="apple-touch-icon" href="/static/img/splash/sptouch-icon-iphone.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/static/img/splash/touch-icon-ipad.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/static/img/splash/touch-icon-iphone-retina.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/static/img/splash/touch-icon-ipad-retina.png">

    <!-- iOS web-app metas : hides Safari UI Components and Changes Status Bar Appearance -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!-- Startup image for web apps -->
    <link rel="apple-touch-startup-image" href="/static/img/splash/ipad-landscape.png"
          media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
    <link rel="apple-touch-startup-image" href="/static/img/splash/ipad-portrait.png"
          media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
    <link rel="apple-touch-startup-image" href="/static/img/splash/iphone.png"
          media="screen and (max-device-width: 320px)">

    <style>
        #main {
            margin-left: 0;
            padding: 0;
            position: relative;
        }

        .log-main {
            position: relative;
            padding: 0 6px 0 14px;
        }

        pre {
            white-space: pre-wrap;
            word-wrap: break-word;
            color: #DDDDDD;
            width: 100%;
            height: 495px;
            border: 0;
            background-color: #000000;
            overflow: auto
        }

        #result {
            margin-top: -20px;
            margin-bottom: -10px;
        }
    </style>

</head>

<!--

TABLE OF CONTENTS.

Use search to find needed section.

===================================================================

|  01. #CSS Links                |  all CSS links and file paths  |
|  02. #FAVICONS                 |  Favicon links and file paths  |
|  03. #GOOGLE FONT              |  Google font link              |
|  04. #APP SCREEN / ICONS       |  app icons, screen backdrops   |
|  05. #BODY                     |  body tag                      |
|  06. #HEADER                   |  header tag                    |
|  07. #MAIN PANEL               |  main panel                    |
|  08. #MAIN CONTENT             |  content holder                |
|  09. #PLUGINS                  |  all scripts and plugins       |

===================================================================
-->

<!-- #BODY -->
<body>

<!-- #MAIN PANEL -->
<div id="main" role="main">

    <!-- #MAIN CONTENT -->
    <div class="log-main">
        <div class="margin-top-5"></div>
        [
        <span class='istyle txt-color-redLight'>Logger Monitor</span>
        ]:
        <span id="nowtime"></span> 正在嗅探,请稍后 (Sniffing, please hold on)
        <span id="waitspan"></span>
        <div class="margin-top-5"></div>
        <pre id="repre">
            <div id="result"></div>
            <div class='waitray'>_</div>
        </pre>
        <iframe id="comet-frame" style="display: none;"></iframe>

    </div>

</div>
<!-- END #MAIN PANEL -->

<!--================================================== -->

<!-- #PLUGINS -->
<!-- Link to Google CDN's jQuery + jQueryUI; fall back to local -->
<script src="/static/js/libs/jquery-2.2.0.js"></script>

<script src="/static/js/libs/jquery-ui-1.11.4.js"></script>

<!-- IMPORTANT: APP CONFIG -->
<script src="/static/js/app.config.js"></script>

<!-- JS TOUCH : include this plugin for mobile drag / drop touch events-->
<script src="/static/js/plugin/jquery-touch/jquery.ui.touch-punch.js"></script>

<!-- BOOTSTRAP JS -->
<script src="/static/js/bootstrap/bootstrap.js"></script>

<!-- JARVIS WIDGETS -->
<script src="/static/js/smartwidgets/jarvis.widget.js"></script>

<!-- JQUERY UI + Bootstrap Slider -->
<script src="/static/js/plugin/bootstrap-slider/bootstrap-slider.js"></script>

<!-- browser msie issue fix -->
<script src="/static/js/plugin/msie-fix/jquery.mb.browser.js"></script>

<!-- FastClick: For mobile devices: you can disable this in app.js -->
<script src="/static/js/plugin/fastclick/fastclick.js"></script>

<!-- web socket -->
<script src="/static/js/plugin/websocket/sockjs.js"></script>
<script src="/static/js/plugin/websocket/stomp.js"></script>

<!-- layer plugin -->
<script src="/static/js/plugin/layer/layer.js"></script>

<!-- MAIN APP JS FILE -->
<script src="/static/js/app.js"></script>

<!-- SCRIPTS ON PAGE EVENT -->
<script type="text/javascript">
    /* DO NOT REMOVE : GLOBAL FUNCTIONS!
     *
     * pageSetUp(); WILL CALL THE FOLLOWING FUNCTIONS
     *
     * // activate tooltips
     * $("[rel=tooltip]").tooltip();
     *
     * // activate popovers
     * $("[rel=popover]").popover();
     *
     * // activate popovers with hover states
     * $("[rel=popover-hover]").popover({ trigger: "hover" });
     *
     * // activate inline charts
     * runAllCharts();
     *
     * // setup widgets
     * setup_widgets_desktop();
     *
     * // run form elements
     * runAllForms();
     *
     ********************************
     *
     * pageSetUp() is needed whenever you load a page.
     * It initializes and checks for all basic elements of the page
     * and makes rendering easier.
     *
     */
    pageSetUp();

    /*
     * ALL PAGE RELATED SCRIPTS CAN GO BELOW HERE
     */
    // PAGE RELATED SCRIPTS
    // pagefunction
    var pagefunction = function () {

        // $('#comet-frame')[0].src = "${ctx}/logMonitor";

        window.setInterval(doRay, 500);
        var waitRay = 0;

        function doRay() {
            waitRay++;
            if (waitRay == 1) $(".waitray").text("_");
            else if (waitRay == 2) $(".waitray").text(" ");
            else {
                waitRay = 0;
                $(".waitray").text("_");
            }
        }

        var $result = $('#result');
        //此方法由window.parent.updateLogger
        function updateLogger(data) {
            var color = "txt-color-blueLight";
            if (data.indexOf('INFO') >= 0)
                color = "txt-color-green";
            else if (data.indexOf('WARN') >= 0)
                color = "txt-color-yellow";
            else if (data.indexOf('ERROR') >= 0)
                color = "txt-color-red";
            data = data.replace("[", " [<span class='" + color + "'>");
            data = data.replace("]", "</span>]");
            $result.append(data);
            $result.append("<br/>");
        }

        window.updateLogger = updateLogger;

        function printNow(opt) {
            var mydate = new Date();
            var mymonth = parseInt(mydate.getMonth() + 1) < 10 ? "0" + (mydate.getMonth() + 1) : mydate.getMonth() + 1;
            var myday = mydate.getDate();
            var myyear = mydate.getYear();
            var myHours = mydate.getHours();
            var myMinutes = mydate.getMinutes();
            var mySeconds = parseInt(mydate.getSeconds()) < 10 ? "0" + mydate.getSeconds() : mydate.getSeconds();
            var year = (myyear > 200) ? myyear : 1900 + myyear;
            $(opt).text(year + "-" + mymonth + "-" + myday + " " + myHours + ":" + myMinutes + ":" + mySeconds);
            setTimeout("printNow('" + opt + "')", 1000);
        }

        window.printNow = printNow;

        printNow("#nowtime");
        var waitsign = 0;
        setInterval(dowait, 1000);
        var $wait = $("#waitspan");

        function dowait() {
            if (waitsign == 6) {
                waitsign = 0;
                $wait.text(".");
            } else {
                $wait.text($wait.text() + ".");
                waitsign++;
            }
        }

        //////////// ///////////////
        // web socket 方式
        //////////// ///////////////
        var stompClient = null;

        // 连接
        function connect() {
            var socket = new SockJS('/socket');
            stompClient = Stomp.over(socket);
            stompClient.connect({}, function (frame) {
                console.log('Connected: ' + frame);
                stompClient.subscribe('/topic/logger-info', function (data) {

                    if (data && data.body) {

                        if (data.body.message) {
                            updateLogger(data.body.message);
                        } else {
                            updateLogger(data.body);
                        }
                    }
                });
            });
            // 连接慢,设置延迟
            setTimeout(loginCheck, 3000);
        }

        connect();

        // 断开
        function disconnect() {
            if (stompClient != null) {
                logoutCheck();
                stompClient.disconnect();
            }
            console.log("Disconnected");
        }

        window.disconnect = disconnect;

        function logoutCheck() {
            stompClient.send("/logger/logout-check", {}, "logger monitor");
        }

        function loginCheck() {
            stompClient.send("/logger/login-check", {}, "logger monitor");
        }
    };

    // destroy generated instances
    // pagedestroy is called automatically before loading a new page
    // only usable in AJAX version!
    var pagedestroy = function () {
        window.updateLogger = undefined;
        window.printNow = undefined;
        window.disconnect = undefined;
    };
    // end destroy

    // load related plugins
    pagefunction();

</script>
<!-- END #MAIN CONTENT -->

</body>

</html>